API Docs
Overview
Name | type | Description |
---|---|---|
SeeSo | class | The main class for utilizing gaze tracking functionality within the seeso_flutter package. |
GazeInfo | class | A class representing gaze information obtained from a gaze event. |
FaceInfo | class | A class representing face information obtained from a face event. |
StatusInfo | class | A class representing status information obtained from a status event. |
CalibrationInfo | class | A class representing calibration information obtained from a calibration event. |
UserStatusInfo | class | A class representing user status information obtained from a user status event. |
OneEuroFilterManager | class | Manages a collection of OneEuroFilters for filtering multiple values. |
InitializedResult | class | Represents the result of the SeeSo gaze tracker initialization. |
CameraPosition | class | This class represents the camera position for Android. |
CalibrationMode | enum | An enumeration representing the calibration modes for calibration processes. |
CalibrationCriteria | enum | An enum representing different calibration criteria or levels. |
TrackingState | enum | Enum representing different states of gaze tracking. |
ScreenState | enum | An enumeration representing different states of gaze position in relation to the device screen. |
EyeMovementState | enum | An enumeration representing different types of eye movement states. |
StatusType | enum | An enumeration representing different types of status events for gaze tracking. |
StatusErrorType | enum | An enumeration representing different types of error scenarios when the gaze tracking status stops. |
CalibrationType | enum | An enumeration representing the different stages within a calibration process. |
UserStatusEventType | enum | An enumeration representing different types of user status events that can be tracked. |
SeeSoOrientation | enum | An enumeration representing different types of gaze events orientation that can be tracked. |
SeeSo
class SeeSo
The SeeSo
class provides methods and properties for initializing and managing gaze tracking capabilities on mobile devices.
Summary
getSeeSoVersion
Future<String?> getSeeSoVersion()
Retrieves the version of SeeSo
for the current platform.
Return Type | Description |
---|---|
Future<String?> | Returns a Future that completes with the version string or null if there is an issue retrieving the version. |
Example
String? seesoVersion;
try {
seesoVersion = await _seesoPlugin.getSeeSoVersion();
} on PlatformException {
seesoVersion = 'Failed to get SeeSo version';
}
checkCameraPermission
Future<bool> checkCameraPermission() async
This function asynchronously checks whether the camera permission is granted for the SeeSo SDK.
Return Type | Description |
---|---|
Future<bool> | true if the camera permission is granted. |
Example
_hasCameraPermission = await _seesoPlugin.checkCameraPermission();
if (!_hasCameraPermission) {
print("Camera permission not granted.")
}
requestCameraPermission
Future<bool> requestCameraPermission() async
Requests camera permission and returns whether the permission is granted.
This function asynchronously requests camera permission from the user.
Return Type | Description |
---|---|
Future<bool> | false if the user denies the camera permission or if the permission was previously denied. |
If the user has previously denied camera permissions, calling this function will not prompt for camera permissions again.
Example
_hasCameraPermission = await _seesoPlugin.requestCameraPermission();
setState(() {
_hasCameraPermissionString = _hasCameraPermission ? "granted" : "denied";
});
initGazeTracker
FutureOr<InitializedResult?> initGazeTracker({
required String licenseKey,
bool useAttention = false,
bool useBlink = false,
bool useDrowsiness = false,
})
Initializes the SeeSo gaze tracker functionality.
You cannot use the functions related to SeeSo's gaze tracking until this function has been called.
This function initializes the SeeSo gaze tracker with the provided licenseKey
and optional feature flags.
Parameters | Type | Description |
---|---|---|
licenseKey | String | The licenseKey parameter is mandatory and should be obtained from manage.seeso.io for authentication. Without a valid license key, the initialization will fail. |
useAttention | bool | The useAttention parameter, when set to true , enables the attention tracking feature, which monitors the user's focus on the screen. |
useBlink | bool | The useBlink parameter, when set to true , enables the blink tracking feature, which detects when the user blinks their eyes. |
useDrowsiness | bool | The useDrowsiness parameter, when set to true , enables the drowsiness tracking feature, which detects when the user appears drowsy. |
The function returns an [InitializedResult] object, which contains information about the success or failure of the initialization process.
Return Type | Description |
---|---|
FutureOr<InitializedResult?> | If the initialization is successful, [result] in theInitializedResult object will be true , and message will be "ERROR_NONE." If the initialization fails, result will be false , and message will provide details about the failure. |
If an error occurs during the initialization process, such as a missing or invalid license key, result
will be null
in the InitializedResult object.
Example
String requestInitGazeTracker = "failed Request";
if (_hasCameraPermission) {
try {
InitializedResult? initializedResult =
await _seesoPlugin.initGazeTracker(licenseKey: _licenseKey); // not use attention, blink, drowsiness
if (initializedResult!.result) {
print("initialized success!.");
} else if (initializedResult!.result == false) {
print("initialized failed! reason : ${initializedResult!.message}");
} else {
print("Occur PlatformException");
}
} on PlatformException catch (e) {
print("Occur PlatformException (${e.message})");
}
}
deinitGazeTracker
Future<void> deinitGazeTracker() async
Deinitializes the SeeSo gaze tracker functionality.
This function is used to gracefully shut down and release resources related to the SeeSo
. After calling this function, other SeeSo-related features cannot be used.
Example
await _seesoPlugin.deinitGazeTracker();
print("seeso deinit!");
_seesoPlugin = null;
getGazeEvent
Stream<dynamic> getGazeEvent()
Retrieves a stream of gaze events for gaze tracking information.
This function returns a stream that provides gaze-related information through GazeEvent objects. Consumers of the stream can receive and process updates about gaze tracking data.
Using the event object received during listen by passing it into GazeInfo makes it easier to handle.
Example
_seesoPlugin.getGazeEvent().listen((event) {
GazeInfo info = GazeInfo(event);
if (info.trackingState == TrackingState.SUCCESS) {
setState(() {
_x = info.x;
_y = info.y;
_gazeColor = Colors.green;
});
} else {
setState(() {
_gazeColor = Colors.red;
});
}
});
getFaceEvent
Stream<dynamic> getFaceEvent()
Retrieves a stream of face events for facial information.
This function returns a stream that provides facial information through FaceEvent objects. Consumers of the stream can receive and process updates about facial data.
Using the event object received during listen by passing it into FaceInfo makes it easier to handle.
Example
_seesoPlugin.getFaceEvent().listen((event) {
FaceInfo info = FaceInfo(event);
print("face in degree pitch(${info.pitch}), yaw(${info.yaw}), roll(${info.roll})")
});
getStatusEvent
Stream<dynamic> getStatusEvent()
Retrieves a stream of status events for tracking status information.
This function returns a stream that provides status information about whether SeeSo
has started or stopped gaze tracking through StatusEvent objects.
Consumers of the stream can receive and process updates about tracking status.
Using the event object received during listen by passing it into StatusInfo makes it easier to handle.
Example
_seesoPlugin.getStatusEvent().listen((event) {
StatusInfo statusInfo = StatusInfo(event);
if (statusInfo.type == StatusType.START) {
setState(() {
_stateString = "start Tracking";
});
} else {
setState(() {
_stateString = "stop Trakcing : ${statusInfo.stateErrorType}";
});
}
});
getCalibrationEvent
Stream<dynamic> getCalibrationEvent()
Retrieves a stream of calibration events for calibration information.
This function returns a stream that provides calibration information through CalibrationEvent objects. Consumers of the stream can receive and process updates about calibration data.
Using the event object received during listen by passing it into CalibrationInfo makes it easier to handle.
Example
_seesoPlugin.getCalibrationEvent().listen((event) {
CalibrationInfo caliInfo = CalibrationInfo(event);
if (caliInfo.type == CalibrationType.CALIBRATION_NEXT_XY) {
setState(() {
_nextX = caliInfo.nextX!;
_nextY = caliInfo.nextY!;
_calibrationProgress = 0.0;
});
Future.delayed(const Duration(milliseconds: 500), () {
_seesoPlugin.startCollectSamples();
});
} else if (caliInfo.type == CalibrationType.CALIBRATION_PROGRESS) {
setState(() {
_calibrationProgress = caliInfo.progress!;
});
} else if (caliInfo.type == CalibrationType.CALIBRATION_FINISHED) {
setState(() {
_isCaliMode = false;
});
}
});
getUserStatusEvent
Stream<dynamic> getUserStatusEvent()
Retrieves a stream of user status events for attention, blink, and drowsiness information.
This function returns a stream that provides user status information, including attention, blink, and drowsiness events, through UserStatusEvent objects. Consumers of the stream can receive and process updates about these user status events.
Using the event object received during listen by passing it into UserStatusInfo makes it easier to handle.
Example
_seeso.getUserStatusEvent().listen((event) {
UserStatusInfo userStatusInfo = UserStatusInfo(event);
if (userStatusInfo.type == UserStatusEventType.ATTENTION) {
attentionInfo = userStatusInfo;
} else if (userStatusInfo.type == UserStatusEventType.BLINK) {
blinkInfo = userStatusInfo;
} else {
drowsinessInfo = userStatusInfo;
}
});
startTracking
Future<void> startTracking() async
Starts the gaze tracking process.
Initiates the process of tracking the user's gaze. Prior to calling this function, make sure to have initialized the gaze tracker using the initGazeTracker function.
If the camera permission is not granted or if the gaze tracker has not been properly initialized, PlatformException
may be thrown.
Example
try {
await _seeso.startTracking();
} on PlatformException catch(e) {
print("failed seeso's startTracking call : ${e.message}");
}
stopTracking
Future<void> stopTracking() async
Stops the ongoing gaze tracking process.
Use this function to halt the gaze tracking operation. Before calling this function, ensure that you have initialized the gaze tracker using the initGazeTracker function.
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
await _seeso.stopTracking();
} on PlatformException catch(e) {
print("failed seeso's stopTracking call : ${e.message}");
}
isTracking
Future<bool?> isTracking() async
Checks whether gaze tracking is currently in progress.
Use this function to determine if the gaze tracking process is active. Before calling this function, make sure you have initialized the gaze tracker using the initGazeTracker function.
Return Type | Description |
---|---|
Futrue<bool?> | false if gaze tracking is not active or if gaze tracking has not been properly initialized. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
bool? isTracking = await _seeso.isTracking();
if (isTracking != null) {
print("failed seeso's isTracking ${isTracking}");
} else {
print("failed seeso's isTracking call");
}
} on PlatformException catch(e) {
print("failed seeso's isTracking call : ${e.message}");
}
setTrackingFPS
Future<bool?> setTrackingFPS(int fps) async
Sets the frames per second (FPS) for gaze tracking in the SeeSo
SDK.
Use this function to specify the desired FPS for gaze tracking in the SeeSo
SDK. The FPS value can range from 1 to 30, with the default FPS being 30 for the front camera.
Parameters | Type | Description |
---|---|---|
fps | int | The desired frames per second for gaze tracking. |
Return Type | Description |
---|---|
Future<bool?> | false if the FPS value is out of range (below 1 or above 30) or if an error occurs. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
bool? isResult = await _seeso.setTrackingFPS(15);
if (isResult != null) {
print("seeso's setTrackingFPS result ${isResult}");
} else {
print("failed seeso's setTrackingFPS call");
}
} on PlatformException catch(e) {
print("failed seeso's setTrackingFPS call : ${e.message}");
}
startCalibration
Future<void> startCalibration(CalibrationMode calibrationMode,
{CalibrationCriteria calibrationCriteria = CalibrationCriteria.DEFAULT,
Rect? region}) async
Starts the calibration process in the SeeSo
SDK.
Use this function to initiate the calibration process in the SeeSo
SDK.
Parameters | Type | Description |
---|---|---|
calibrationMode | CalibrationMode | The calibration mode to be used. Choose from modes 1, 5, and 6 which display different numbers of calibration targets. |
calibrationCriteria | CalibrationCriteria | The calibration criteria to be used. If not specified, the default criteria will be used. |
region | Rect ? | The region of the device screen where calibration targets will be displayed. If not specified, the calibration targets will be shown on the entire screen. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
await _seeso.startCalibration(calibrationMode);
print("Start Calibration!");
} on PlatformException catch (e) {
print("failed seeso's startCalibration call : ${e.message}");
}
stopCalibration
Future<void> stopCalibration() async
Stops the ongoing calibration process in the SeeSo
SDK.
Use this function to interrupt the ongoing calibration process in the SeeSo
SDK. Any progress made before stopping will not be applied.
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
_seeso.stopCalibration();
isCalibrating = false;
} on PlatformException catch (e) {
print("failed seeso's stopCalibration call : ${e.message}");
}
isCalibrating
Future<bool?> isCalibrating() async
Checks whether the SeeSo
SDK is currently in the process of calibration.
Use this function to determine if the SeeSo
SDK is currently performing a calibration process.
Return Type | Description |
---|---|
Future<bool?> | false if the SDK is not calibrating or if an error occurs during the process. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
await _seeso.startCalibration(calibrationMode);
bool? isCalibrating = await _seeso.isCalibrating();
if (isCalibrating != null && isCalibrating == true) {
print("Start Calibration!");
}
} on PlatformException catch (e) {
print("failed seeso's startCalibration call : ${e.message}");
}
startCollectSamples
Future<void> startCollectSamples() async
Notifies the SeeSo
SDK to begin collecting samples for the current calibration target.
Use this function to inform the SeeSo SDK that you have displayed the calibration target point on the UI, and you are ready to start collecting calibration data for that target.
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
_seeso.getCalibrationEvent().listen((event) {
CalibrationInfo calibrationInfo = CalibrationInfo(event);
if (calibrationInfo.type == CalibrationType.CALIBRATION_NEXT_XY) {
if (calibrationInfo.nextX != null && calibrationInfo.nextY != null) {
nextPoint = Point(calibrationInfo.nextX!, calibrationInfo.nextY!);
progress = 0;
try {
_seeso.startCollectSamples();
} on PlatformException catch (e) {
print("failed seeso's startCollectSamples call : ${e.message}");
}
}
}
});
setCalibrationData
Future<bool?> setCalibrationData(List<double> data) async
Sets the calibration data to the SeeSo
SDK for calibration refinement.
Use this function to provide the SeeSo
SDK with previously collected calibration data for calibration refinement or adjustment.
Parameters | Type | Description |
---|---|---|
data | List<double> | The data parameter should be a list of doubles containing the calibration data. |
Return Type | Description |
---|---|
Future<bool?> | true if the calibration data is successfully set. false if the calibration data setting fails.null if an error occurs during the data setting process. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
_seeso.getCalibrationEvent().listen((event) {
CalibrationInfo calibrationInfo = CalibrationInfo(event);
if (calibrationInfo.type == CalibrationType.CALIBRATION_FINISHED) {
calibrationData = calibrationInfo.calibrationData
isCalibrating = false;
}
});
void loadCalibrationData() async {
try {
_seeso.setCalibrationData(calibrationData);
} on PlatformException catch (e) {
print("failed seeso's startCollectSamples call : ${e.message}");
}
}
setAttentionInterval
Future<void> setAttentionInterval(int interval) async
Sets the interval for receiving Attention-related events in the SeeSo
SDK's UserStatusEvent.
Use this function to adjust the frequency at which Attention-related events are received in the UserStatusEvent stream from the SeeSo
SDK.
Parameters | Type | Description |
---|---|---|
interval | int | The interval parameter determines the time interval, in seconds, between each received Attention event. The default interval is 30 seconds, and it can be set between 10 to 60 seconds. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
// I will receive attention-related information every 10 seconds.
_seeso.setAttentionInterval(10);
} on PlatformException catch (e) {
print("failed seeso's setAttentionInterval call : ${e.message}");
}
getAttentionScore
Future<double?> getAttentionScore() async
Retrieves the current Attention score from the SeeSo
SDK.
Use this function to get the current Attention score from the SeeSo
SDK.
Return Type | Description |
---|---|
Future<double>? | The returned value is a double between 0 and 1, representing the user's attention level. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
double? currentScore = _seeso.getAttentionScore();
if (currentScore != null) {
print("current attention score : ${currentScore}");
}
} on PlatformException catch (e) {
print("failed seeso's getAttentionScore call : ${e.message}");
}
setAttentionRegion
Future<void> setAttentionRegion(Rect region) async
Sets the region of interest (ROI) for the Attention feature in the SeeSo
SDK.
Use this function to set the region of interest (ROI) for the Attention feature in the SeeSo
SDK.
Parameters | Type | Description |
---|---|---|
region | Rect | The region parameter should be a Rect object representing the area of interest on the camera view. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Example
try {
// roi is x : 10, y : 10, width : 100, height : 100
Rect roi = Rect(10, 10, 100, 100);
_seeso.setAttentionRegion(roi);
} on PlatformException catch (e) {
print("failed seeso's setAttentionRegion call : ${e.message}");
}
getAttentionRegion
Future<Rect?> getAttentionRegion() async
Retrieves the currently set region of interest (ROI) for the Attention feature in the SeeSo
SDK.
Use this function to get the currently set region of interest (ROI) for the Attention feature in the SeeSo
SDK. The returned Rect
object represents the area of interest on the view.
Return Type | Description |
---|---|
Future<Rect?> | The currently set region of interest (ROI) for the Attention feature, or null if not available. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Examples
try {
Rect? roi = await _seeso.getAttentionRegion();
if (roi != null) {
print("current roi is ${roi.toString()}");
}
} on PlatformException catch (e) {
print("failed seeso's setAttentionRegion call : ${e.message}");
}
removeAttentionRegion
Future<void> removeAttentionRegion() async
Removes the currently set region of interest (ROI) for the Attention feature in the SeeSo
SDK.
Use this function to remove the currently set region of interest (ROI) for the Attention feature
in the SeeSo
SDK. After removal, attention-related information will not be provided.
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown.
Examples
try {
Rect? roi = await _seeso.getAttentionRegion();
if (roi != null) {
await _seeso.removeAttentionRegion();
print("removed attention region");
}
} on PlatformException catch (e) {
print("failed seeso's setAttentionRegion or removeAttentionRegion call : ${e.message}");
}
isDeviceFound
Future<bool?> isDeviceFound() async
Checks whether the necessary device information is available for the SeeSo SDK.
Use this function to determine if the required device information is available for accurate functioning of the SeeSo SDK. It is important to have the correct device information to ensure optimal performance.
Return Type | Description |
---|---|
Future<bool?> | false if the necessary device information is not available or if the gaze tracker has not been properly initialized. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown. Additionally, this function is specific to Android, and if used on iOS, MissingPluginException
may occur.
Example
try {
bool? isDeviceFound = await _seeso.isDeviceFound();
if (isDeviceFound != null) {
print("failed seeso's isDeviceFound ${isDeviceFound}");
} else {
print("failed seeso's isDeviceFound call");
}
} on PlatformException catch(e) {
print("failed seeso's isDeviceFound call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is iOS ${e.message}");
}
addCameraPosition
Future<void> addCameraPosition(CameraPosition cameraPosition) async
Adds the camera position information for the SeeSo
SDK.
Use this function to provide the SeeSo
SDK with the necessary camera position information to improve the accuracy of gaze tracking. The cameraPosition parameter should contain the relevant camera position data.
Parameters | Type | Descrption |
---|---|---|
cameraPosition | CameraPosition | The camera position information to be added for the SeeSo SDK. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown. Additionally, This function is specific to Android. If used on iOS, a MissingPluginException
.
Example
try {
CameraPosition cameraPosition = CameraPosition(
modelName: "test",
screenWidth: 1080,
screenHeight: 720,
screenOriginX: -30,
screenOriginY: 5);
await _seeso.addCameraPosition(cameraPosition);
} on PlatformException catch(e) {
print("failed seeso's addCameraPosition call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is iOS ${e.message}");
}
getCameraPosition
Future<CameraPosition?> getCameraPosition()
Retrieves the current CameraPosition used by the SeeSo
SDK.
Use this function to get the camera position information that is currently being used by the SeeSo
SDK.
Return Type | Description |
---|---|
Future<CameraPosition?> | currently being used by the SeeSo SDK. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown. Additionally, This function is specific to Android. If used on iOS, a MissingPluginException
.
Example
try {
CameraPosition? cameraPosition = await _seeso.getCameraPosition();
if (cameraPositon != null) {
print("current cameraPosition : ${cameraPosition!.modelName}");
} else {
print("seeso's getCameraPosition is null");
}
} on PlatformException catch(e) {
print("failed seeso's getCameraPosition call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is iOS ${e.message}");
}
getCameraPositionList
Future<List<CameraPosition>?> getCameraPositionList() async
Retrieves the list of current CameraPosition used by the SeeSo
SDK.
Use this function to get a list of camera position information that is currently being used by the SeeSo
SDK.
The returned list contains CameraPosition objects, each representing a different camera position.
Return Type | Description |
---|---|
Future<List<CameraPosition>?> | The CameraPosition currently being used by the SeeSo SDK, or null if not available. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown. Additionally, This function is specific to Android. If used on iOS, a MissingPluginException
.
Example
try {
List<CameraPosition>? cameraPositions = await _seeso.getCameraPositionList();
if (cameraPositions != null) {
for(CameraPosition cp : cameraPositions) {
print("CameraPosition : ${cp.modelName}");
}
} else {
print("seeso's getCameraPositionList is null");
}
} on PlatformException catch(e) {
print("failed seeso's getCameraPositionList call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is iOS ${e.message}");
}
selectCameraPosition
Future<void> selectCameraPosition(int idx) async
Selects a specific camera position from the list of available camera positions in the SeeSo SDK
.
Use this function to choose a camera position from the list of available camera positions in the SeeSo
SDK by providing its
idx
value.
Parameters | Type | Description |
---|---|---|
idx | int | The index of the camera position to be selected. |
If the camera permission is not granted or if the gaze tracker has not been properly initialized, a PlatformException
may be thrown. Additionally, This function is specific to Android. If used on iOS, a MissingPluginException
.
Example
try {
List<CameraPosition>? cameraPositions = await _seeso.getCameraPositionList();
if (cameraPositions != null && cameraPositions.length > 1) {
await _seeso.selectCameraPosition(2);
} else {
print("seeso's getCameraPositionList is null");
}
} on PlatformException catch(e) {
print("failed seeso's getCameraPositionList or selectCameraPosition call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is iOS ${e.message}");
}
setForcedOrientation
Future<bool?> setForcedOrientation(SeeSoOrientation orientation) async
Forces a manual orientation change for the device in the SeeSo
SDK.
Use this function to manually change the orientation of the device in the SeeSo
SDK.
Parameters | Type | Description |
---|---|---|
orientation | SeeSoOrientation | The orientation parameter specifies the desired orientation using the SeeSoOrientation enum. |
Return Type | Description |
---|---|
Future<bool?> | true if the orientation change was successful. false if the orientation change failed or if the feature is not supported. null if an error occurs during the process. |
Before calling this function, ensure that the gaze tracker has been properly initialized and that camera permission is granted. Otherwise, a PlatformException
may be thrown.
Additionally, please be aware that this function is specific to iOS. If used on Android, a MissingPluginException
may occur.
Example
try {
// set landscpe_left orientation.
bool? result = await _seeso.setForcedOrientation(SeeSoOrientation.LANDSCAPE_LEFT);
if (result != null && result == true) {
print("changed.")
} else {
print("seeso's setForcedOrientation is fail");
}
} on PlatformException catch(e) {
print("failed seeso's setForcedOrientation call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is Android ${e.message}");
}
resetForcedOrientation
Future<bool?> resetForcedOrientation() async
Resets the previously forced orientation for the device in the SeeSo
SDK.
Use this function to reset the previously set forced orientation for the device in the SeeSo
SDK. After calling this function, the device's orientation will be set automatically.
Return Type | Description |
---|---|
Future<bool?> | true if the reset of forced orientation was successful. false if the reset failed or if the feature is not supported. null if an error occurs during the process. |
Before calling this function, ensure that the gaze tracker has been properly initialized and that camera permission is granted. Otherwise, a PlatformException
may be thrown.
Additionally, please be aware that this function is specific to iOS. If used on Android, a MissingPluginException
may occur.
Example
try {
// set landscpe_left orientation.
bool? result = await _seeso.setForcedOrientation(SeeSoOrientation.LANDSCAPE_LEFT);
if (result != null && result == true) {
print("changed.")
} else {
print("seeso's setForcedOrientation is fail");
}
// after 500ms, reset forced orientation.
Timer(const Duration(milliseconds: 500), () {
_seeso.resetFocedOrientation();
});
} on PlatformException catch(e) {
print("failed seeso's setForcedOrientation call : ${e.message}");
} on MissingPluginException catch(e) {
print("current platform is Android ${e.message}");
}
GazeInfo
class GazeInfo
A class representing gaze information obtained from a gaze event.
Summary
Variable | Type | Description |
---|---|---|
timestamp | int | The timestamp in milliseconds when the gaze event occurred. |
x | double | The X-coordinate of the gaze position on the screen in pixels. |
y | double | The Y-coordinate of the gaze position on the screen in pixels. |
fixationX | double | The X-coordinate of the last fixation position on the screen in pixels. |
fixationY | double | The Y-coordinate of the last fixation position on the screen in pixels. |
leftOpenness | double | The degree of openness of the left eye (applicable when blink detection is enabled). |
rightOpenness | double | The degree of openness of the right eye (applicable when blink detection is enabled). |
trackingState | TrackingState | The state of gaze tracking. |
eyeMovementState | EyeMovementState | The state of eye movement. |
screenState | ScreenState | The state of gaze position in relation to the screen. |
Function |
---|
Constructor |
setGaze |
setFixationGaze |
Constructor
GazeInfo(Map<dynamic, dynamic> event)
Creates a GazeInfo instance using the provided gaze event event
. The event
should contain all the necessary information for creating a GazeInfo object.
Map<dynamic, dynamic>
event
Key (String) | Value Type |
---|---|
TIMESTAMP | int |
X | double |
Y | double |
FIXATION_X | double |
FIXATION_Y | double |
LEFT_OPENNESS | double |
RIGHT_OPENNESS | double |
TRACKING_STATE | String |
EYE_MOVEMENT_STATE | String |
SCREEN_STATE | String |
Example
_seesoPlugin.getGazeEvent().listen((event) {
GazeInfo info = GazeInfo(event);
});
setGaze
void setGaze(double x, double y)
This is a function that modifies the x and y values of GazeInfo
Parameters | type | description |
---|---|---|
x | double | The X-coordinate of the gaze position on the screen in pixels. |
y | double | The Y-coordinate of the gaze position on the screen in pixels. |
Example
_seeso.getGazeEvent().listen((event) {
GazeInfo gazeInfo = GazeInfo(event);
this.gazeInfo = gazeInfo;
bool isFiltered = _filterManager
.filterValues(gazeInfo.timestamp, [gazeInfo.x, gazeInfo.y]);
if (isFiltered) {
// changed filterd gaze x, y;
this.gazeInfo?.setGaze(_filterManager.getFilteredValues()[0],
_filterManager.getFilteredValues()[1]);
}
});
setFixationGaze
void setFixationGaze(double fixationX, double fixationY)
This is a function that modifies the fixationX and fixationY values of GazeInfo
Parameters | Type | Description |
---|---|---|
fixationX | double | The X-coordinate of the last fixation position on the screen in pixels. |
fixationY | double | The Y-coordinate of the last fixation position on the screen in pixels. |
Example
_seeso.getGazeEvent().listen((event) {
GazeInfo gazeInfo = GazeInfo(event);
this.gazeInfo = gazeInfo;
bool isFiltered = _filterManager
.filterValues(gazeInfo.timestamp, [gazeInfo.fixationX, gazeInfo.fixationY]);
if (isFiltered) {
// changed filterd fixation x, y;
this.gazeInfo?.setFixationGaze(_filterManager.getFilteredValues()[0],
_filterManager.getFilteredValues()[1]);
}
});
FaceInfo
class FaceInfo
Creates a FaceInfo instance using the provided event data.
The event
should be a map containing raw data from a FaceEvent. This constructor converts the raw event data into a user-friendly object format.
Summary
Variable | Type | Description |
---|---|---|
timestamp | int | The timestamp when the facial information was captured. |
score | double | The confidence score of facial recognition (ranging from 0.0 to 1.0). |
frameSize | Size | The size of the frame containing the face in pixels. |
rect | Rect | The rectangular region in which the face is located. |
pitch | double | The pitch rotation of the face in degrees. |
yaw | double | The yaw rotation of the face in degrees. |
roll | double | The roll rotation of the face in degrees. |
centerX | double | The distance from the camera to the face's center along the X-axis in millimeters. |
centerY | double | The distance from the camera to the face's center along the Y-axis in millimeters. |
centerZ | double | The distance from the camera to the face's center along the Z-axis in millimeters. |
Function |
---|
Constructor |
Constructor
FaceInfo(Map<dynamic, dynamic> event)
Creates a FaceInfo instance with the provided event data.
The event
should be a map containing raw data from a FaceEvent.
The constructor extracts and assigns the relevant data fields to the corresponding properties.
Map<dynamic, dynamic>
event
Key (String) | Value Type |
---|---|
TIMESTAMP | int |
SCORE | double |
FRAME_WIDTH | double |
FRAME_HEIGHT | double |
FIXATION_Y | double |
LEFT | double |
TOP | double |
RIGHT | double |
BOTTOM | double |
PITCH | double |
PITCH | double |
YAW | double |
ROLL | double |
CENTER_X | double |
CENTER_Y | double |
CENTER_Z | double |
Example
_seesoPlugin.getFaceEvent().listen((event) {
FaceInfo info = FaceInfo(event);
});
StatusInfo
class StatusInfo
A class that represents information about status events, converting raw event data from a StatusEvent
into a user-friendly object format.
Summary
Variable | Type | Description |
---|---|---|
type | StatusType | The type of the status event, indicating whether it's a start or stop event. |
stateErrorType | StatusErrorType? | The type of error that occurred if the status event represents a stop event. |
Function |
---|
Constructor |
Constructor
StatusInfo(Map<dynamic, dynamic> event)
Creates a StatusInfo instance using the provided event data.
The event
should be a map containing raw data from a StatusEvent. This constructor extracts and assigns the relevant data fields to the corresponding properties.
Map<dynamic, dynamic>
event
Key (String) | Value Type |
---|---|
STATUS_EVENT_TYPE | String |
STATUS_FAILED_REASON | String |
Example
_seeso.getStatusEvent().listen((event) {
StatusInfo statusInfo = StatusInfo(event);
if (statusInfo.type == StatusType.START) {
// todo start tracking state
} else {
// todo stop tracking state
}
});
CalibrationInfo
class CalibrationInfo
A class that represents information about calibration events, converting raw event data from a CalibrationEvent into a user-friendly object format.
Summary
Variable | Type | Description |
---|---|---|
type | CalibrationType | The type of the calibration event, indicating its purpose and meaning. |
progress | double? | The progress value of the ongoing calibration, ranging from 0.0 to 1.0. |
nextX | double? | The X-coordinate of the next calibration target when the type is CALIBRATION_NEXT_XY. |
nextY | double? | The Y-coordinate of the next calibration target when the type is CALIBRATION_NEXT_XY. |
progress | List<double>? | The calibration data values when the type is CALIBRATION_FINISHED. |
Function |
---|
Constructor |
Constructor
CalibrationInfo(Map<dynamic, dynamic> event)
Creates a CalibrationInfo instance using the provided event data.
The event
should be a map containing raw data from a CalibrationEvent. This constructor extracts and assigns the relevant data fields to the corresponding properties.
Map<dynamic, dynamic>
event
Key (String) | Value Type |
---|---|
CALIBRATION_TYPE | String |
PROGRESS | double |
NEXT_X | double |
NEXT_Y | double |
CALIBRATION_DATA | List |
Example
_seeso.getCalibrationEvent().listen((event) {
CalibrationInfo calibrationInfo = CalibrationInfo(event);
if (calibrationInfo.type == CalibrationType.CALIBRATION_NEXT_XY) {
// todo next tart setting
} else if (calibrationInfo.type == CalibrationType.CALIBRATION_PROGRESS) {
// todo current target progress
} else {
// todo calibration finished state
}
});
UserStatusInfo
class UserStatusInfo
A class that represents user status information events, converting raw event data from a UserStatusEvent into a user-friendly object format.
Summary
Variable | Type | Description |
---|---|---|
type | UserStatusEventType | The type of the user status event, indicating the specific type of tracking being performed. |
timestamp | int? | The timestamp when the user status event occurred. |
timestampBegin | int? | The beginning timestamp of the event, in milliseconds, when applicable. |
timestampEnd | int? | The ending timestamp of the event, in milliseconds, when applicable. |
attentionScore | double? | The attention score of the user, ranging from 0.0 to 1.0, when applicable. |
isBlinkLeft | bool? | Indicates whether the left eye is blinked, when applicable. |
isBlinkRight | bool? | Indicates whether the right eye is blinked, when applicable. |
isBlink | bool? | Indicates whether both eyes are blinked, when applicable. |
leftOpenness | double? | The openness score of the left eye, ranging from 0.0 to 1.0, when applicable. |
rightOpenness | double? | The openness score of the right eye, ranging from 0.0 to 1.0, when applicable. |
isDrowsiness | bool? | Indicates whether drowsiness is detected, when applicable. |
drowsinessIntensity | double? | The intensity of drowsiness, ranging from 0.0 to 1.0, when applicable. |
Function |
---|
Constructor |
Constructor
UserStatusInfo(Map<dynamic, dynamic> event)
Creates a UserStatusInfo instance using the provided event data.
The event
should be a map containing raw data from a UserStatusEvent. This constructor extracts and assigns the relevant data fields to the corresponding properties.
Map<dynamic, dynamic>
event
Key (String) | Value Type |
---|---|
USER_STATUS_EVENT_TYPE | String |
USER_STATUS_TIMESTAMP_BEGIN | int |
USER_STATUS_TIMESTAMP_END | int |
USER_STATUS_ATTENTION_SCORE | double |
USER_STATUS_TIMESTAMP | int |
USER_STATUS_IS_BLINK_LEFT | bool |
USER_STATUS_IS_BLINK_RIGHT | bool |
USER_STATUS_IS_BLINK | bool |
USER_STATUS_LEFT_OPENNESS | double |
USER_STATUS_RIGHT_OPENNESS | double |
USER_STATUS_IS_DROWSINESS | bool |
USER_STATUS_DROWSINESS_INTENSITY | double |
Example
_seeso.getUserStatusEvent().listen((event) {
UserStatusInfo userStatusInfo = UserStatusInfo(event);
if (userStatusInfo.type == UserStatusEventType.ATTENTION) {
//todo attention event proccessed.
} else if (userStatusInfo.type == UserStatusEventType.BLINK) {
//todo blink event proccessed.
} else {
//todo drowsiness event proccessed.
}
});
OneEuroFilterManager
class OneEuroFilterManager
Manages a collection of OneEuroFilters for filtering multiple values.
Summary
Function |
---|
Constructor |
filterValues |
getFilteredValues |
Constructor
OneEuroFilterManager(
{required int count,
freq = _defaultFrequency,
minCutOff = _defaultMinCutOFF,
beta = _defaultBeta,
dCutOff = _defaultDCutOFF})
Use this constructor to initialize the filter and specify the number of values to filter and the filter's settings.
Parameters | Type | Description |
---|---|---|
count | int | The number of values to filter. For example, if set to 2, it filters two input values separately. |
freq | double | Represents the sampling frequency of the data. The default value is 30.0 |
minCutOff | double | Minimum cutoff frequency used to filter noise in the data. The default value is 1.0 |
beta | double | Indicates the strength of applying the derivative filter. The default value is 0.007 |
dCutOff | double | Represents the cutoff frequency for the derivative data. The default value is 1.0 |
Example
he method uses default values for freq, minCutOff, beta, and dCutOff.
OneEuroFilterManager _filterManager = OneEuroFilterManager(count: 2);
filterValues
bool filterValues(int timestamp, List<double> val)
Performs filtering for the given timestamp and a list of values.
Use this method to perform filtering on the given data and obtain the filtered results. If filtering fails or if there are invalid values, the filter is reset, and false is returned.
Parameters | Type | Description |
---|---|---|
timestamp | int | Represents the timestamp of the data and is used for filtering. |
val | List<double> | A list of values to be filtered, representing the values for which you want to obtain filtered results. |
Return Type | Description |
---|---|
bool | If a value is invalid or anomalous, the filter is reset, and false is returned. If the filtering is successful, it returns true. |
Example
GazeInfo gazeInfo = GazeInfo(event);
this.gazeInfo = gazeInfo;
if (_useFilter) {
bool isFiltered = _filterManager
.filterValues(gazeInfo.timestamp, [gazeInfo.x, gazeInfo.y]);
if (isFiltered) {
print("filtered success!");
}
}
getFilteredValues
List<double> getFilteredValues()
Retrieves the filtered values obtained after applying the filter.
This function returns a list of filtered double values that have been processed using the filter. It allows you to access the filtered results for further use.
Return Type | Description |
---|---|
List<double> | A list of filtered double values. |
Example
bool isFiltered = _filterManager
.filterValues(gazeInfo.timestamp, [gazeInfo.x, gazeInfo.y]);
if (isFiltered) {
List<Double> filtered = _filterManager.getFilteredValues();
print("filtered (x ,y) : (${filtered[0]}, ${filtered[1]})");
}
InitializedResult
class InitializedResult
Represents the result of the SeeSo gaze tracker initialization.
Use this class to obtain the result of the initialization process after calling initGazeTracker.
See Authentication for more details.
Summary
Variable | Type | Description |
---|---|---|
result | bool | The result field indicates whether the initialization was successful. |
message | String | The message field provides additional information in case of failure. In case of a successful initialization, message will be "ERROR_NONE." |
Function |
---|
Constructor |
Constructor
InitializedResult(Map<dynamic, dynamic> resultMap)
Creates an instance of InitializedResult by parsing a result map.
The resultMap
should contain the necessary keys and values for initializing the fields
Map<dynamic, dynamic>
resultMap
Key (String) | Value Type |
---|---|
INITIALIZED_RESULT_KEY | String |
PROINITIALIZED_RESULT_MESSAGE_KEYGRESS | String |
It is recommended that developers do not create this themselves.
CameraPosition
class CameraPosition
This class represents the camera position for Android.
This class is intended to be used on Android platform only.
Summary
Variable | Type | Description |
---|---|---|
modelName | String | The model name of the mobile device. |
screenWidth | double | The width of the screen in pixels. |
screenHeight | double | The height of the screen in pixels. |
screenOriginX | double | The distance in millimeters from the front camera to the screen origin (0, 0). |
screenOriginY | double | The distance in millimeters from the front camera to the screen origin (0, 0). |
cameraOnLongerAxis | bool | Indicates whether the camera is mounted on the longer axis of the device. |
Function |
---|
Constructor |
Constructor
CameraPosition({
required this.modelName,
required this.screenWidth,
required this.screenHeight,
required this.screenOriginX,
required this.screenOriginY,
this.cameraOnLongerAxis = false,
})
Creates a CameraPosition instance with the provided parameters.
Parameters | Type | Description |
---|---|---|
modelName | String | The modelName should be the model name of the mobile device. |
screenWidth | double | The screenWidth represent the dimensions of the screen in pixels. |
screenHeight | double | The screenHeight represent the dimensions of the screen in pixels. |
screenOriginX | double | The screenOriginX are distances in millimeters from the front camera to the screen origin (0, 0). |
screenOriginY | double | The screenOriginY are distances in millimeters from the front camera to the screen origin (0, 0). |
cameraOnLongerAxis | bool | cameraOnLongerAxis indicates whether the camera is mounted on the longer axis of the device (default is false). |
Example
/// This is information about the Galaxy Fold 5 when it is folded.
CameraPosition cameraPosition = CameraPosition(
modelName: "SM-F946N",
screenWidth: 904,
screenHeight: 2316,
screenOriginX: -28.5,
screenOriginY: 5);
CalibrationMode
enum CalibrationMode
An enumeration representing the calibration modes for calibration processes.
Members | Description |
---|---|
ONE | Represents a calibration mode with one target point. |
FIVE | Represents a calibration mode with five target points. It provides higher accuracy compared to the ONE mode. |
SIX | Represents a calibration mode with six target points. |
It offers even higher accuracy and precision, suitable for demanding calibration requirements. |
CalibrationCriteria
enum CalibrationCriteria
An enum representing different calibration criteria or levels.
The CalibrationCriteria enum is used to define various calibration settings or criteria that can be applied during the calibration process.
Members | Description |
---|---|
DEFAULT | Default calibration setting level suitable for general users. |
HIGH | High calibration setting level suitable for users requiring precise or high-accuracy calibration. |
LOW | Low calibration setting level suitable for users looking to complete calibration quickly with lower accuracy. |
TrackingState
enum TrackingState
Enum representing different states of gaze tracking.
Members | Description |
---|---|
SUCCESS | Gaze tracking was successful without any issues. |
LOW_CONFIDENCE | Gaze tracking was successful but with low confidence level. |
UNSUPPORTED | Denotes an unsupported tracking state, where the face is detected but the current settings result in an unexpected tracking state that cannot be accommodated. |
FACE_MISSING | Gaze tracking failed because the face was not detected. |
ScreenState
enum ScreenState
An enumeration representing different states of gaze position in relation to the device screen.
Members | Description |
---|---|
INSIDE_OF_SCREEN | Represents a state where the gaze position is inside the device screen. |
OUTSIDE_OF_SCREEN | Indicates a state where the gaze position is outside the device screen. |
UNKNOWN | Denotes an unknown state of gaze position, typically occurring when gaze tracking is not accurate. |
EyeMovementState
enum EyeMovementState
An enumeration representing different types of eye movement states.
Members | Description |
---|---|
FIXATION | Represents a state where the eye movement is a fixation, indicating a stable gaze position. |
SACCADE | Indicates a state where the eye movement is a saccade, indicating a rapid shift in gaze position. |
UNKNOWN | Denotes an unknown eye movement state, typically occurring when gaze tracking is not accurate. |
StatusType
enum StatusType
An enumeration representing different types of status events for gaze tracking.
Members | Description |
---|---|
START | Indicates that gaze tracking has started. |
STOP | Indicates that gaze tracking has stopped. |
StatusErrorType
enum StatusErrorType
An enumeration representing different types of error scenarios when the gaze tracking status stops.
Members | Description |
---|---|
ERROR_NONE | GazeTracker.stopTracking call succeeded without any errors. |
ERROR_CAMERA_START | Error code occurs when GazeTracker.startTracking is called, but the front camera of the device is not available. |
ERROR_CAMERA_INTERRUPT | Error code occurs when the camera becomes unavailable, interrupting gaze tracking. |
CalibrationType
enum CalibrationType
An enumeration representing the different stages within a calibration process.
Members | Description |
---|---|
CALIBRATION_PROGRESS | Indicates an event providing updates on the progress of the ongoing calibration target. |
CALIBRATION_NEXT_XY | Provides information regarding the XY coordinates of the upcoming calibration target. |
CALIBRATION_FINISHED | Marks the successful completion of the entire calibration process. |
UserStatusEventType
enum UserStatusEventType
An enumeration representing different types of user status events that can be tracked.
Members | Description |
---|---|
ATTENTION | Indicates that the tracker is configured to detect user's attention. |
BLINK | Indicates that the tracker is configured to detect user's blinking. |
DROWSINESS | Indicates that the tracker is configured to detect user's drowsiness. |
SeeSoOrientation
enum SeeSoOrientation
An enumeration representing different types of gaze events orientation that can be tracked.
events that can be tracked, especially on the iOS platform. It is primarily used for the purpose of forcibly changing the direction of gaze coordinates.
Members | Description |
---|---|
PORTRAIT | The device is in portrait mode, with the device upright and the Home button on the bottom. |
PORTRAIT_UPSIDE_DOWN | The device is in portrait mode but is upside down, with the device upright and the Home button at the top. |
LANDSCAPE_LEFT | The device is in landscape mode, with the device upright and the Home button on the left. |
LANDSCAPE_RIGHT | The device is in landscape mode, with the device upright and the Home button on the right. |